package com.yiqi.liebang.feature.home.model;

import com.suozhang.framework.component.http.RxDataProcessFactory;
import com.yiqi.liebang.entity.bo.ExpertBo;
import com.yiqi.liebang.entity.bo.QuestionBo;
import com.yiqi.liebang.entity.bo.SearchBo;
import com.yiqi.liebang.entity.bo.SearchFriendBo;
import com.yiqi.liebang.entity.bo.TopicListBo;
import com.yiqi.liebang.feature.home.contract.FriendsContract;
import com.yiqi.liebang.feature.home.contract.QuestionContract;
import com.yiqi.liebang.feature.home.dependencies.friends.DaggerFriendsModelComponent;
import com.yiqi.liebang.feature.home.dependencies.question.DaggerQuestionModelComponent;
import com.yiqi.liebang.framework.api.ApiLib;
import com.yiqi.liebang.framework.api.HomeApi;

import java.util.List;

import javax.inject.Inject;

import io.reactivex.Observable;

public class FriendsModel implements FriendsContract.Model {

    @Inject
    HomeApi api;


    @Inject
    public FriendsModel() {
        DaggerFriendsModelComponent.builder().apiComponent(ApiLib.apiComponent()).build().inject(this);
    }




    @Override
    public Observable<SearchFriendBo> searchFriends(SearchBo searchBo) {
        return api.searchFriends(searchBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<List<SearchFriendBo.UserFriendBean>> searchExpert(SearchBo searchBo) {
        return api.searchFriendHJ(searchBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }
}
